package com.glory.dgcpcpda.adapter;

import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.dgcpcpda.R;
import com.glory.dgcpcpda.entity.RepairSheetDataEntity;

import java.util.List;

/**
 * FileName: PartReplacrListAdapter
 * Author: XJH
 * Date: 2020/8/22 15:49
 * Description:
 * History:
 */
public class PartReplaceListAdapter extends BaseQuickAdapter<RepairSheetDataEntity.PartListEntity, BaseViewHolder> {
    public PartReplaceListAdapter(@Nullable List<RepairSheetDataEntity.PartListEntity> data) {
        super(R.layout.item_part_replacr_adapter,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RepairSheetDataEntity.PartListEntity item) {
        helper.setText(R.id.tvPosition,String.valueOf(helper.getAdapterPosition() + 1));
        helper.setText(R.id.tvPartName,item.getPARTSDESC());
        helper.setText(R.id.tvPartID,item.getPARTSID());
        helper.getView(R.id.ivDelete).setOnClickListener(view -> {
            remove(helper.getAdapterPosition());
            notifyDataSetChanged();
        });
    }
}
